key_released
This function checks if a particular key on the keyboard has just been released.
bool key_released(int key)
Parameters:
key
One of the BGT key name constants, see appendix A for a full list.
Return value:
true if the key has just been released, false if it has not or if an error occurs.
Remarks:
The difference between key_up and key_released is that key_released will only return true when the user first releases the key, while key_up will continue returning true until the key is down.
Example:
// Speak a message when the space bar is released.
void main()
{
tts_voice voice;
show_game_window("Test Game");
while(true)
{
if(key_pressed(KEY_SPACE))
{
voice.speak_interrupt("Space bar pressed.");
}
if(key_released(KEY_SPACE))
{
voice.speak_interrupt("Space bar released.");
}
if(key_pressed(KEY_ESCAPE))
{
exit();
}
// Other code goes here.
wait(5);
}
}